home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / GRAPHIC / PERSISTE.H < prev    next >
C/C++ Source or Header  |  1992-01-10  |  3KB  |  83 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Interface to Persistent and related base classes.
  25.  */
  26.  
  27. #ifndef persistent_h
  28. #define persistent_h
  29.  
  30. #include <InterViews/defs.h>
  31. #include <InterViews/Graphic/classes.h>
  32.  
  33. #define INVALIDUID    1
  34.               /* INVALIDUID & OBJMANUID must be consecutive uids */
  35. #define OBJMANUID    3   
  36.  
  37. typedef unsigned long UID;
  38.  
  39. class ListObject;
  40. class ObjectMan;
  41. class PFile;
  42. class Persistent;
  43.  
  44. extern ObjectMan* TheManager;        /* the well-known global object manager */
  45.  
  46. class Persistent {            /* basic (persistent) Persistent */
  47.     friend class Ref;
  48.     friend class ObjectMan;
  49. public:
  50.     Persistent();
  51.     virtual ~Persistent();
  52.  
  53.     virtual Persistent* GetCluster();
  54.     /*
  55.      * returns head of cluster.  If GetCluster is redefined to return
  56.      * nil, then the object is assumed to be within the "current"
  57.      * cluster, i.e., it is a part of whatever cluster is currently
  58.      * being written out or read in.  If the object is Saved explicitly,
  59.      * a warning is issued and the object is NOT saved.
  60.      */
  61.     virtual boolean Save();
  62.     virtual boolean IsDirty();
  63.     virtual void Touch();
  64.     virtual void Clean();
  65.  
  66.     virtual ClassId GetClassId();
  67.     virtual boolean IsA(ClassId);
  68. protected:
  69.     virtual UID getUID();
  70.  
  71.     void Warning(const char*);
  72.     void Panic(const char*);
  73.     void Fatal(const char*);
  74.  
  75.     virtual boolean write(PFile*);
  76.     virtual boolean read(PFile*);
  77.     virtual boolean writeObjects(PFile*);
  78.     virtual boolean readObjects(PFile*);
  79.     virtual boolean initialize();
  80. };
  81.  
  82. #endif
  83.